﻿<?php
//数据库类db
class db {
	var $link;
	function __construct() {
		
	}
	//连接数据库
	function connect($dbhost,$dbuser,$dbpass,$dbname) {
		$this->link = new mysqli($dbhost,$dbuser,$dbpass,$dbname);
		//检查连接
		if(mysqli_connect_errno()) {
			printf("数据库连接失败: %s\n", mysqli_connect_error());
			exit();
		}
		$this->link->close();
	}
}
?>